<?php
class Danhba_Model extends CI_Model{

	public function __construct(){
		parent::__construct();
		$this->db 		= $this->load->database('default', TRUE);
	}
	public function get_DanhBaById($ref=null){
		$this->db->order_by("orders","asc");
		$data = $this->db->get_where("danhba",array('cat_id' => $ref));
		return $data->result_array();
	}
	public function get_paged_list($limit = 24, $offset = 0,$ref){
		//		$this->db->order_by('id','asc');
		//		$this->db->where(array('email' => $email)); //Thanh them
		//		return $this->db->get('diary', $limit, $offset);
		$data = $this->db->get_where('danhba', array('cat_id'=>$ref),$limit, $offset);
		return $data->result_array();
	}
	public function count_AllById($ref=null){
		$sql="select count(*) as total from danhba where cat_id=?";
		$data=$this->db->query($sql,array($ref));
		return $data->result_array();
	}
}